import { IsArray, IsNotEmpty, IsOptional, MaxLength } from 'class-validator';
import { MenuManage } from '../../menuManage/entities/menuManage.entity';
import { RoleManage } from '../entities/roleManage.entity';

export class CreateRoleDto {
  @MaxLength(50, { message: '名称不能超过50个字符' })
  @IsNotEmpty({ message: '名称不能为空' })
  name: string;

  @IsOptional()
  @IsArray({ message: 'menus必须是一个数组' })
  menus: MenuManage[];

  @IsOptional()
  @IsArray({ message: 'roles必须是一个数组' })
  userRoles: RoleManage[];
}
